home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-03-27 | 1.8 KB | 88 lines | [UVtx/UVtl] |
- // This program demonstrates animating a picture using
- // the Curve command. While the picture is moving, the
- // program changes the 'move' parameter, such that at one
- // time the picture is moving above the background, and
- // at other times it is below the background.
-
- Init()
-
- DefPicture()
-
- DrawRectangles()
-
- PrepareToMove()
-
- Curve Fx(t), 50*sin(t*(360/200)), t, -width()/2-30, width()/2+20
-
- ////////////////////////////////////////
-
- /////////////
- Function Init()
- above=0
- last_flip = 0
-
- ////////////////////
- Function DefPicture()
- Picture "MoveIt"
- Fill 1,30000,40000,50000
- Repeat 2
- Forward 30
- Circle 10
- Forward 1*π*10
- Straight
-
- /////////////////////////
- Function DrawRectangles(x)
- up
- go -width()/2, -55,0
- do
- fil 1,64926,65535,49999
- fo width()
- go width()/2, -height()/2, 180
- fo width()
- Repeat x,-width()/2+20, width()/2-20,100
- Rect(x)
-
- ///////////////
- Function Rect(X)
- Up
- w = random(5)+5
- Goto X-w,-100-last_flip*20,90
- last_flip = 1 - last_flip
- Down
- Repeat 2
- Fill 1+int(random(2)),random(60000),random(60000), random(60000)
- Forward 200
- Right 90
- Forward 2*w
- Right 90
- x1 = x()
- y1 = y()
- fi 1,0,0,0
- go x1+40,y1-20,0
- fo 2*w
- go x1+2*w,y1,0
-
-
- ///////////////////////////////////////
- Function PrepareToMove()
- Up
- Pen picture="MoveIt",speed=40
- Goto -width()/2-50,0,0
- Down
- last_flip = 0
-
- ////////////
- Function Fx(X)
- If last_flip = 0 // first time thru
- last_flip = X
- Return X
- dx = X - last_flip
- If (dx > 100)
- last_flip = X
- If above
- Pen move="above"
- Else
- Pen move="below"
- above = 1-above
- Return X